package com.sdkj.jiang.controller;

import com.sdkj.jiang.dto.EmpDto;
import com.sdkj.jiang.po.Emp;
import com.sdkj.jiang.service.EmpService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/empController")
public class EmpController {
    @Resource
    private EmpService empService;

    @RequestMapping("/search")
    public List<Emp> search(EmpDto empDto){
        List<Emp> emps = null;
        emps = empService.search(empDto);
//        System.out.println(empDto.getEname());
//        System.out.println(empDto.getLosal());

        return emps;
    }
    @RequestMapping("/delete")
    public int delete(int empno){
        return empService.doDelete(empno);
    }
    @RequestMapping("/edit")
    public int edit(EmpDto empDto){
        return empService.doUpdate(empDto);
    }
}
